using System;
using System.Collections.Generic;

namespace Universe.OneC.DomainModel
{
    public class MetaModel
    {
        public List<Association> Associations = new List<Universe.OneC.DomainModel.Association>();
        public string Name;
        public List<Namespace> Namespaces = new List<Namespace>();
        public Dictionary<string, MetaClass> Registry = new Dictionary<string, Universe.OneC.DomainModel.MetaClass>();
        public string Version;

        public MetaClass GetMetadata(Type type)
        {
            return this.Registry[type.FullName];
        }

        public List<MetaClass> GetTableParts(MetaClass owner)
        {
            List<MetaClass> ret = new List<MetaClass>();
            foreach (MetaClass value in Registry.Values)
            {
                if (value.Owner == owner && value.GetGroup2() == MetaClassGroup.TablePart)
                    ret.Add(value);
            }

            return ret;
        }
    }
}